// TYPEDEFS //
struct HullInputType
{
	float4 pos          : POSITION;         //posizione
    float2 tex			: TEXCOORD;			//Coordinate texture
};

struct ConstantOutputType
{
    float edges[3] : SV_TessFactor;
    float inside : SV_InsideTessFactor;
};

struct HullOutputType
{
	float4 pos          : POSITION;         //posizione
    float2 tex			: TEXCOORD;			//Coordinate texture
};


// Patch Constant Function
ConstantOutputType TexturePatchConstantFunction(InputPatch<HullInputType, 3> inputPatch, uint patchId : SV_PrimitiveID)
{    
    ConstantOutputType output;
	float tessBase = 1;
    output.edges[0] = tessBase;
    output.edges[1] = tessBase;
    output.edges[2] = tessBase;
    output.inside = tessBase;

    return output;
}


// Hull Shader
[domain("tri")]
[partitioning("integer")]
[outputtopology("triangle_cw")]
[outputcontrolpoints(3)]
[patchconstantfunc("TexturePatchConstantFunction")]
HullOutputType TextureHullShader(InputPatch<HullInputType, 3> patch, uint pointId : SV_OutputControlPointID, uint patchId : SV_PrimitiveID)
{
    HullOutputType output;

    output.pos		= patch[pointId].pos;
    output.tex		= patch[pointId].tex;
	
    return output;
}
